<template>
    <div class="m-window">
        <accept 
            :activeIndex="active"
            :list1="list1"
            :list2="list2"
            :list3="list3" />
    </div>
</template>
<script>
import Accept from '@/components/SRM/pageComponents/accept.vue'

export default {
    props:{
        applyId: {
            type: String,
            required:true
        },
    },
    data() {
        return {
            active:0,
            list1:[],
            list2:[],
            list3:[]
        }
    },
    created(){
        this.list1 = [
            {
                name:'流程编号',
                text:'',
                isHit:true,
                isUnderline:true
            },
            {
                name:'融资产品',
                text:'天进宝'
            },
            {
                name:'融资金额',
                text:''
            },
            {
                name:'服务费率（含税）',
                text:''
            }
        ]
        this.list3= [
            {
                name:'申请人',
                text:''
            },
            {
                name:'申请人手机号',
                text:'',
                isHit:true
            },
            {
                name:'客服',
                text:''
            },
            {
                name:'客服电话',
                text:'',
                isHit:true
            }
        ]
        this.list2 = [
            {
                name:'<i class="el-icon-service" style="font-size: 20px;font-weight: 600;color: #000;"></i>',
                text:'请先联系客服'
            }
        ]
    },
    beforeMount(){
        if(!this.applyId){
            this.$alert("获取申请表信息失败", {
                confirmButtonText: "确定",
                customClass: "alertFailure"
            });
        }else{
            this.$http
            .getApplyInfo({id:this.applyId})
            .then(response => {
            if (response.data.code == 200) {
                let data = response.data.rows
                this.list1[0].text = data.itemNo
                this.list1[2].text = data.applyAmt
                this.list1[3].text = data.rate
                this.list3[0].text = data.custUser
                this.list3[1].text = data.custPhone
                this.list3[2].text = data.custserviceName
                this.list3[3].text = data.custservicePhone
                // this.active = data.activityCode ? data.activityCode : 0
            } else {
                this.$alert("获取申请表信息失败", {
                confirmButtonText: "确定",
                customClass: "alertFailure"
                });
            }
            })
            .catch(errror => {
                this.$alert("获取申请表信息失败，请检查网络！", {
                    confirmButtonText: "确定",
                    customClass: "alertFailure"
                });
            });
            this.$http.getApplyInstanceInf({applyId:this.applyId}).then(response =>{
                if(response.data.code == 200){
                    let activityCode = response.data.rows.activityCode ? response.data.rows.activityCode : 0
                    if(activityCode == 'act_fin_server_accept'){//客服受理
                        this.active = 0
                    }else if(activityCode == 'act_fin_lawyer_accept'){//法务受理，线下评审
                        this.active = 1
                    }else if(activityCode == 'act_cust_commit'){//供应商提交申请表
                        this.active = 2
                    }else{
                        this.active = 3
                    }
                }else{
                    this.$alert("获取申请表流程信息失败", {
                    confirmButtonText: "确定",
                    customClass: "alertFailure"
                    });
                }
            })
            .catch(errror => {
                this.$alert("获取申请表流程信息失败，请检查网络！", {
                    confirmButtonText: "确定",
                    customClass: "alertFailure"
                });
            });
        }
    },
    components:{
        Accept
    }
}
</script>